/**
 * Licensee: Universidad del Pais Vasco
 * License Type: Academic
 */
package ormsamples;

import org.orm.*;
public class CreateBibliotecaData {
	public void createTestData() throws PersistentException {
		PersistentTransaction t = orm.BibliotecaPersistentManager.instance().getSession().beginTransaction();
		try {
			orm.Recurso lormRecurso = orm.RecursoDAO.createRecurso();
			// Initialize the properties of the persistent object here
			orm.RecursoDAO.save(lormRecurso);
			orm.Usuario lormUsuario = orm.UsuarioDAO.createUsuario();
			// Initialize the properties of the persistent object here
			orm.UsuarioDAO.save(lormUsuario);
			t.commit();
		}
		catch (Exception e) {
			t.rollback();
		}
		
	}
	
	public static void main(String[] args) {
		try {
			CreateBibliotecaData createBibliotecaData = new CreateBibliotecaData();
			try {
				createBibliotecaData.createTestData();
			}
			finally {
				orm.BibliotecaPersistentManager.instance().disposePersistentManager();
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}
